#!/usr/bin/perl

use strict;
use XML::RPC;
use Data::Dumper;
use LWP::Simple;
use Encode;

use constant XMLRPC => 'http://localhost:8080/exist/xmlrpc';

my $server = XML::RPC->new(XMLRPC);

my $result = $server->call("createCollection", "/db/rss_pais/");
my $xml = get 'http://www.elpais.com/rss/feed.html?feedId=1022';

$xml =~ m/encoding=\"(.*?)\"/g;

$xml = decode $1, $xml;
my $timestamp = localtime();

$result = $server->call("parse", $xml, "/db/rss_pais/$timestamp");

print Dumper $result;
